package com.company.jvm.classloader;

import lombok.extern.slf4j.Slf4j;

/**
 * @ClassName ClassLoaderTest
 * @Description TODO
 * @Author ylr
 * @Date 2021/7/20 16:00
 * @Version 1.0
 */

@Slf4j
public class ClassLoaderTest {
    static {
        System.out.println("静态初始化块执行了！");
    }
    public ClassLoaderTest() {
        System.out.println("调用构造函数！");
    }

    public static void main(String[] args) {
        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
        log.info(
                "loader:{}\n" + "loader.getParent:{}\n" + "loader.getParent.getParent:{}\n",
                contextClassLoader, contextClassLoader.getParent(), contextClassLoader.getParent().getParent()
        );


    }
}
